<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8" isELIgnored="false"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt"%>
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@3.3.7/dist/css/bootstrap.min.css">
<link rel="stylesheet" href="${pageContext.request.contextPath }/css/style.css">
<!-- ============================= JavaScript ============================= -->
<script type="text/javascript">
	//【提交】查询用户
	function findUser() {
		var frm = document.getElementById("frmQuery");
		frm.action = "${pageContext.request.contextPath}/userManage/UserList";
		frm.submit();
	}
	//【提交】增加用户
	function addUser() {
		var frm = document.getElementById("frmQuery");
		frm.action = "${pageContext.request.contextPath}/addResp";
		frm.submit();
	}
	//【提交】删除用户
	function delUser(account, id) {
		var frm = document.getElementById("frmList");
		var isDel = confirm("确定要删除系统账户：" + account + " 吗？");
		if (isDel == true) {
			var hidden = document.getElementsByName("id")[0];
			hidden.value = id;
			frm.action = "${pageContext.request.contextPath}/userManage/doUserDelete.action";
			frm.submit();
		}
	}
</script>
</head>
<body>
	<div class="hight_def2"></div>
	<div class="container">
		<div class="row">
			<div class="col-md-1"></div>
			<div class="col-md-10">
				<form id="frmQuery" method="post" class="form-inline">
					<div class="form-group">
						<input type="search" name="txtUserName" value="${attrUserName}" placeholder="请输入账户或用户名" class="form-control" />
						<input type="button" value="查询用户" onclick="findUser()" class="btn btn-primary btn-sm" />
						<input type="button" value="添加用户" onclick="addUser()" class="btn btn-success btn-sm" />
					</div>
				</form>
				<p></p>
				<form id="frmList">
					<table class="table table-striped table-bordered table-hover table-condensed">
						<tr>
							<th>系统账号</th>
							<th>用户名</th>
							<th>岗位</th>
							<th>部门</th>
							<th>操作</th>
						</tr>
						<c:forEach items="${list}" var="user" >
							<tr>
								<td>${user.username}</td>
								<td>${user.name}</td>
								<td>${user.job}</td>
								<td>${user.deptName}</td>
<%--								<td>${user.updateTime}</td>--%>
								<td><a href="${pageContext.request.contextPath}/userManage/userUpdate.action?id=${users.id}"
									class="btn btn-info btn-xs">修改 </a>&nbsp;&nbsp; <a
									href="javascript:void(0)"
<%--									onclick="delUser('${user.account}','${user.id}')"--%>
									class="btn btn-danger btn-xs"> 删除</a></td>
							</tr>
						</c:forEach>
					</table>
					<input type="hidden" name="id" />
				</form>
			</div>
		</div>
	</div>
</body>
</html>